package mc

import (
	"gitee.com/dreamwood/ez-go/db/mgo"
)

const (
	SellFeedbackEventNew           = "erp.SellFeedbackNew"
	SellFeedbackEventBeforeCreate  = "erp.SellFeedbackBeforeCreate"
	SellFeedbackEventBeforeUpdate  = "erp.SellFeedbackBeforeUpdate"
	SellFeedbackEventBeforeSave    = "erp.SellFeedbackBeforeCreate erp.SellFeedbackBeforeUpdate"
	SellFeedbackEventAfterCreate   = "erp.SellFeedbackAfterCreate"
	SellFeedbackEventAfterUpdate   = "erp.SellFeedbackAfterUpdate"
	SellFeedbackEventAfterSave     = "erp.SellFeedbackAfterCreate erp.SellFeedbackAfterUpdate"
	SellFeedbackEventDelete        = "erp.SellFeedbackDelete"
	SellFeedbackAccessControlEvent = "erp.SellFeedbackAccessControl"
)

func GetSellFeedbackConfig() *mgo.DocConfig {
	return SellFeedback_Config
}

var SellFeedback_Config *mgo.DocConfig

func init() {
	SellFeedback_Config = NewSellFeedbackConfig()
}
func NewSellFeedbackConfig() *mgo.DocConfig {
	return &mgo.DocConfig{
		ContainerKey: "erp.SellFeedback",
		Fields: []string{
			"sn", "title", "buyer", "buyerName", "payType", "deliverAt", "deliver", "contactEmp", "contact", "contactPhone", "status", "isCancel", "isClose", "isConfirm", "confirmAt", "formAt", "formEmp", "createEmp", "note", "product",
		},
		RelationFields: []string{
			"buyer", "payType", "contactEmp", "status", "formEmp", "createEmp", "product",
		},
		RelationConfigs: map[string]*mgo.DocRelation{
			"buyer": {
				Config:     GetBuyerConfig,
				DocName:    "Buyer",
				JoinType:   "O",
				KeyInside:  "buyerId",
				KeyOutSide: "id",
			},
			"payType": {
				Config:     GetPayTypeConfig,
				DocName:    "PayType",
				JoinType:   "O",
				KeyInside:  "payTypeId",
				KeyOutSide: "id",
			},
			"contactEmp": {
				Config:     GetEmpConfig,
				DocName:    "Emp",
				JoinType:   "O",
				KeyInside:  "contactEmpId",
				KeyOutSide: "id",
			},
			"status": {
				Config:     GetSellFeedbackStatusConfig,
				DocName:    "SellFeedbackStatus",
				JoinType:   "O",
				KeyInside:  "statusId",
				KeyOutSide: "id",
			},
			"formEmp": {
				Config:     GetEmpConfig,
				DocName:    "Emp",
				JoinType:   "O",
				KeyInside:  "formEmpId",
				KeyOutSide: "id",
			},
			"createEmp": {
				Config:     GetEmpConfig,
				DocName:    "Emp",
				JoinType:   "O",
				KeyInside:  "createEmpId",
				KeyOutSide: "id",
			},
			"product": {
				Config:     GetSellFeedbackProductConfig,
				DocName:    "SellFeedbackProduct",
				JoinType:   "M",
				KeyInside:  "id",
				KeyOutSide: "belongToId",
			},
		},
		FieldFilter: map[string]*mgo.DocFieldFilter{
			"default": {
				Select: []string{},
				Omit:   []string{},
			},
		},
	}
}
